#ifndef _EXCEPTION_H_
#define _EXCEPTION_H_

#include "./text.h"

#define ALLOW_EXCEPT

namespace Except {

	using namespace Define;
	using namespace Text;

	class Exception : public Wtb, public Clsb {
	protected:
		string message;
		/*! exception that caused this excetption */
		Exception *innerException;

	public:
		Exception( const string &message, Exception *innerException = NULL );
		Exception( const Exception &original );
		virtual ~Exception();

		inline string getMessage() const {
			return message;
		};
		inline Exception* getInnerException() const {
			return innerException;
		};

		// --- Writeable ---
		virtual bool filePrint( FILE *parq = stdin ) const;

		virtual inline string toS() const {
			return "> Exception:\n" + message + ( innerException != NULL ? "\n> Inner Exception:\n" + innerException->toS() : "" );
		};

		// --- Classificable ---

		static inline string ClassName() {
			return "Exception";
		};

		virtual inline string className() const {
			return ClassName();
		};

	};

};

#endif // _EXCEPTION_H_
